<?php
/**
 * Created by PhpStorm.
 * User: qylxz
 * Date: 2018/10/9
 * Time: 上午10:42
 */

namespace app\admin\model;


use think\Db;
use think\Model;

class ApplyopenModel extends Model
{
    /**
     * 获取所有未审核列表
     */
    public function getUnVerifyList(){
        $list = Db::table('qy_yishenqinggongkai')
            ->where('status', 0)
            ->paginate(10);
        return $list;
    }

    /**
     * 根据uid查询信息
     */
    public function getInfo($uid){
        $info = Db::table('qy_yishenqinggongkai')
            ->where('id', $uid)
            ->find();
        return $info;
    }

    /**
     * 根据id删除某一信息
     */
    public function getDelete($uid){
        $info = Db::table('qy_yishenqinggongkai')
            ->where('id', $uid)
            ->setField('status', 3);
        return $info;
    }

    /**
     * 将某一未审核或未通过的id改为已审核
     */
    public function getChange($uid){
        $info = Db::table('qy_yishenqinggongkai')
            ->where('id', $uid)
            ->setField('status', 1);
        return $info;
    }

    /**
     * 将某一未审核改成未通过
     */
    public function unPassVerify($data){
        $isSuccess = Db::table('qy_yishenqinggongkai')
            ->where('id', $data['id'])
            ->update(['yuanyin'=>$data['yuanyin'], 'status'=>2]);
        return $isSuccess;

    }

    /**
     * 获取所有已审核列表
     */
    public function getVerifyList(){
        $list = Db::table('qy_yishenqinggongkai')
            ->where('status', 1)
            ->paginate(10);
        return $list;
    }

    /**
     * 获取所有未通过列表
     */
    public function getUnPassList(){
        $list = Db::table('qy_yishenqinggongkai')
            ->where('status', 2)
            ->paginate(10);
        return $list;
    }

    /**
     * 获取三种类型各自总个数
     */
    public function getCount($where){
        $count = Db::table('qy_yishenqinggongkai')
            ->where($where)
            ->count();
        return $count;
    }


}